Compiler Design
Q131.
Consider the following ANSI C program:int main () { Integer x; return 0; } Which one of the following phases in a seven-phase C compiler will throw an error?Q133.
In a bottom-up evaluation of a syntax directed definition, inherited attributes canQ134.
Consider the following Java code fragment: public class While { public void loop() { int x = 0; while(1) { System.out.println("x plus one is" +(x+1)); } } }Q135.
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code\begin{array}{lll} P & \rightarrow & D^* E^* \\ D & \rightarrow & \textsf{int ID} \{ \text{record that } \textsf{ID.} \text{lexeme is of type} \textsf{ int\}} \\ D & \rightarrow & \textsf{bool ID} \{ \text{record that } \textsf{ID.} \text{lexeme is of type} \textsf{ bool\}} \\ E& \rightarrow & E_1 +E_2 \{ \text{check that } E_1. \text{type}=E_2. \text{type} = \textsf{int}; \text{set } E.\text{type }:= \textsf{int} \} \\ E & \rightarrow & !E_1 \{ \text{check that } E_1. \text{type} = \textsf{bool}; \text{ set } E.\text{type} := \textsf{bool} \} \\ E & \rightarrow & \textsf{ID} \{ \text{set } E. \text{type } := \textsf{int} \} \end{array} With respect to the above grammar, which one of the following choices is correct?Q136.
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted. Consider the calling chain: Main \rightarrow A1 \rightarrow A2 \rightarrow A21 \rightarrow A1 The correct set of activation records along with their access links is given byQ137.
A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar S \rightarrow xxW \;\text{{print "1"}} S \rightarrow y \;\text{{print "2"}} W \rightarrow Sz\; \text{{print "3"}} What is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules?